﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    xmlns:Views="clr-namespace:MvvmFx.Samples.HowTos.PropertyHandlers.Views" 
    xmlns:DataTemplateSelector="clr-namespace:MvvmFx.Samples.HowTos.DataTemplateSelector;assembly=MvvmFx.Common" 
    xmlns:Validation="clr-namespace:MvvmFx.Samples.HowTos.Validation.View" 
    xmlns:HowToDataTemplateSelector="clr-namespace:MvvmFx.Samples.HowTos.DataTemplateSelector" 
    xmlns:DataTemplateSelector1="clr-namespace:MvvmFx.Common.DataTemplateSelector;assembly=MvvmFx.Common" 
    xmlns:View="clr-namespace:MvvmFx.Samples.HowTos.CommandHandlers.View" 
    x:Class="MvvmFx.Samples.HowTos.MainPage"
    d:DesignWidth="640" d:DesignHeight="480">

    <UserControl.Resources>


        <!--<DataTemplate DataType="{x:Type ViewModels1:ContactDetailsViewModel}">
            <Views:ContactDetailsView />
        </DataTemplate>

        <DataTemplate DataType="{x:Type PropertyRehandlers:BoolViewModel}">
            <PropertyRehandlers:BoolView />
        </DataTemplate>-->

    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot">
    	<Grid.RowDefinitions>
    		<RowDefinition Height="480"/>
    	</Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <controlsToolkit:DockPanel>

            <TextBlock Text="How To.." 
                       FontSize="18" HorizontalAlignment="Center" VerticalAlignment="Center" 
                       controlsToolkit:DockPanel.Dock="Top"/>

            <ListBox 
    	        ItemsSource="{Binding HowTos}"
    	        DisplayMemberPath="Key"
    	        SelectedItem="{Binding SelectedHowTo, Mode=TwoWay}"
            />
            
        </controlsToolkit:DockPanel>

        <DataTemplateSelector1:DataContentControl Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="{Binding SelectedHowTo}" Margin="0,28,0,0">
            <DataTemplateSelector1:DataContentControl.Resources>
             
                <DataTemplate x:Key="ValidationDataTemplate">
                    <Validation:DeliveryView/>
                </DataTemplate>

                <DataTemplate
                    x:Key="PropertyHandlersDataTemplate">
                    <Views:PropertyHandlersView />
                </DataTemplate>

                <DataTemplate
                    x:Key="ViewModelHelperDataTemplate"
                    xmlns:Views="clr-namespace:MvvmFx.Samples.HowTos.ViewModelHelper.Views">
                    <Views:ViewModelHelperView />
                </DataTemplate>

                <DataTemplate
                    x:Key="CommandHandlersSampleDataTemplate">
                    <View:CommandHandlersSampleView />
                </DataTemplate>
                
            </DataTemplateSelector1:DataContentControl.Resources>
            <DataTemplateSelector1:DataContentControl.ContentTemplateSelectorBase>
                <HowToDataTemplateSelector:HowTosDataTemplateSelector/>
            </DataTemplateSelector1:DataContentControl.ContentTemplateSelectorBase>
        </DataTemplateSelector1:DataContentControl>
    </Grid>
</UserControl>
